/**
 * @properties={typeid:35,uuid:"515276AD-513F-431F-8C67-3D027D13C957",variableType:93}
 */
var fFechaHasta = null;

/**
 * @properties={typeid:35,uuid:"D95D2010-617A-4600-A60B-0228F9FC8104",variableType:93}
 */
var fFechaDesde = null;

/**
 * @properties={typeid:35,uuid:"91D5CE8B-65BE-412F-A483-8144551FD95A",variableType:4}
 */
var fMedico = null;

/**
 * @properties={typeid:35,uuid:"45FCA4E7-A2E9-48E8-A609-F18D668C1840",variableType:4}
 */
var fPaciente = null;

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"804DD75F-B162-4C8D-B064-C9758F36C7F8"}
 */
function buscar(event) {
	controller.find()
	
	paciente_id 		= fPaciente
	medico_id 			= fMedico
	var $fecha 			= '#' + utils.dateFormat(fFechaDesde,'dd-MM-yyyy') + '...'+utils.dateFormat(fFechaHasta,'dd-MM-yyyy')
	fecha_turno_origen 	= $fecha + '|dd-MM-yyyy'
	saldo_mov 			= '>0'
	tipo_movim 			= '!= 2'
	
	if (controller.search() == 0)
		globals.gDialog('Aviso','No se encontraron resultados','OK')
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"B16B0B26-5739-41E5-8C5C-F1D5F41CA646"}
 */
function onShow(firstShow, event) {
	if (firstShow)
	{
		controller.find()
		tipo_movim 	= '!= 2'
		saldo_mov 	= '>0'
		controller.search()
	}
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"974C2398-0AFE-4133-A0FA-ECEBF23F7370"}
 */
function pagar(event) {
	forms.pagar_saldo_2.controller.loadRecords(id_cc)
	application.showFormInDialog(forms.pagar_saldo_2,-1,-1,-1,-1,'Paga Saldo',false,false,'PAGA_SALDO',true)
}
